package com.yanlin.apiboss.controller;

import com.yanlin.apiboss.service.UserService;
import com.yanlin.internalcommon.dto.DriverUser;
import com.yanlin.internalcommon.dto.ResponseResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.sql.Driver;

/**
 * <p>标题：DriverUserController</p>
 * <p>功能：</p>
 * <p>
 * 其他说明：
 * </p>
 * <p>审核：</p>
 * <p>重构：</p>
 * <p>创建日期：2025-06-13 07:48</p>
 *
 * @author yanlin
 */
@RestController
@Slf4j
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("/driver-user")
    public ResponseResult getUser(@RequestParam Integer state) {
        log.info("用户状态：{}", state);
        return userService.getUser(state);
    }

    @PostMapping("/driver-user")
    public ResponseResult addUser(@RequestBody DriverUser driverUser) {
        log.info("用户信息 ：{}",  driverUser);
        return userService.addUser(driverUser);
    }

    @PutMapping("/driver-user")
    public ResponseResult updateUser(@RequestBody DriverUser driverUser) {
        log.info("用户信息修改：{}", driverUser);
        return userService.updateUser(driverUser);
    }
}